const mongoose = require("mongoose")
const schema = new mongoose.Schema(
  {
    video: { type: mongoose.Types.ObjectId, index: true, required: true },
    author: { type: mongoose.Types.ObjectId, ref: "User" },
    content: String,
    date: Number,
    reply: [
      {
        from: { type: mongoose.Types.ObjectId, ref: "User" },
        to: { type: mongoose.Types.ObjectId, ref: "User" },
        content: String,
        date: Number,
      },
    ],
  },
  {
    timestamps: true,
  }
)
module.exports = mongoose.model("Comment", schema)
